package net.pantolomin.nayo.api;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

/**
 * A basic configuration
 */
public class DefaultConfiguration implements Configuration {
	public ExecutorService getExecutorForReading(final ThreadGroup threadGroup) {
		return Executors.newCachedThreadPool(new ThreadFactory() {
			public Thread newThread(Runnable r) {
				return new Thread(threadGroup, r, "r-executor");
			}
		});
	}

	public ExecutorService getExecutorForWriting(final ThreadGroup threadGroup) {
		return Executors.newCachedThreadPool(new ThreadFactory() {
			public Thread newThread(Runnable r) {
				return new Thread(threadGroup, r, "w-executor");
			}
		});
	}

	public long getConnectionTimeout() {
		return 10000L;
	}

	public long getMaxIdleTime() {
		return 60000L;
	}

	public int getReadBufferSize() {
		return 10240;
	}

	public int getWriteFairness() {
		return 1;
	}
}